<template>
    <header>
        <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
        <img src="@/assets/images/1.svg" alt="">
        <div class="wrapper">
            <HelloWorld msg="You did it!" />

            <nav>
                <RouterLink to="/">Home</RouterLink>
                <RouterLink to="/about">About</RouterLink>
                <el-button type="success">Success</el-button>
            </nav>
        </div>
    </header>
    <RequestTest childProp="测试attrs"></RequestTest>
    <RouterView />
</template>

<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import RequestTest from './views/RequestTest.vue'
import { useCounterStore } from '@/stores/store';
const counterStore = useCounterStore();
console.log('666', counterStore)
console.log('666', counterStore.count)
counterStore.increment()
console.log('666', counterStore.count)
counterStore.updateParam([{'count': 6}])
counterStore.updateParam(['userInfo', {'state': true}])
console.log('666111', counterStore.userInfo)
// const a = {
//     b: 1,
//     a:2
// }
// const b = '6666'
const c = Utils.addNumber(1, 2)
console.log('c', c)
/* eslint-disable no-useless-escape */
const regex1 = /^[a-zA-Z0-9+\-]+$/;
const regex2 = /^[《》]+$/;
const regex3 = /[《》]/g; 
/* eslint-enable no-useless-escape */

function validateString(input: any) {
    // const isValid1 = regex1.test(input);
    // const isValid2 = regex2.test(input);
    return regex2.test(input) || regex1.test(input.replace(regex3, ''))
}

const testStrings = [
    'abc123+-',
    '《》',
    'abc123《',
    '》abc',
    '123+abc-',
    '《123》',
    '《》《'
];

testStrings.forEach(str => {
    console.log(`"${str}" is valid: ${validateString(str)}`);
});
</script>

<style scoped>
.wrapper {
    display: -webkit-box;
    width: 200px;
}
</style>
